<template>
  <div>
    <el-dialog title="上传附件" :visible="multipleOpen" width="30%" @close="cancel">
      <div class="elUploadStyle">
        <el-upload class="upload-demo" drag :action="uploadImgUrl"  :on-success="success"
          :data={configName:configName} multiple>
          <i class="el-icon-upload"></i>
          <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
        </el-upload>
      </div>
    </el-dialog>
  </div> 
</template>

<script>
  export default {
    props: {
      multipleOpen: {
        type: Boolean,
        default: false
      },
      configName: {
        type: String,
        default: ''
      },
      respath: {
        type: String,
        default: ''
      }
    },
    watch: {
      multipleOpen() {
        // this.fileList = []
        // this.getPath()
      }
    },
    data() {
      return {
        uploadImgUrl: process.env.VUE_APP_BASE_API + "/commonPath/outfallReplyUpload",
        fileList: [],
        pathUrl: [],
      }
    },
    methods: {
      success(response, file) {
        this.pathUrl.push(response)
      },
      cancel() {
        this.$emit('update:multipleOpen', false)
      },
      getPath() {
        if(this.respath){
            let arr = []
        let Doc = {}
        arr = this.respath.split('/')
        Doc.name = arr.pop()
        Doc.url = this.respath
        this.fileList.push(Doc)
        }
      }
    }
  }

</script>

<style lang="scss" scoped>
  .elUploadStyle {
    display: flex;
    justify-content: center;
    align-items: center;
  }

</style>
